﻿using Microsoft.Extensions.DependencyInjection;
using WeDonekRpc.Client.Interface;

namespace WeDonekRpc.NetCoreModular
{
    internal class IocScopeFactory : IServiceScopeFactory
    {
        private readonly IIocService _Ioc;

        public IocScopeFactory ( IIocService ioc )
        {
            this._Ioc = ioc;
        }

        public IServiceScope CreateScope ()
        {
            IScoreService scope = this._Ioc.CreateScore();
            return new IocServiceScope(scope);
        }
    }
}
